package com.ifind.test.my;

import com.ifind.async.callback.ICallback;
import com.ifind.async.callback.IWorker;
import com.ifind.async.worker.WorkResult;
import com.ifind.async.wrapper.WorkerWrapper;

import java.util.Map;

/**
 * @author: Carlos
 * @create: 2020/10/29 14:29
 */
public class DeWorker01 implements IWorker<String, String>, ICallback<String, String> {

    @Override
    public String action(String object, Map<String, WorkerWrapper> allWorkers) {
        System.out.println("DeWorker01的参数 = " + object);
        System.out.println("开始执行DeWorker01的action方法");
        String upperCase = object.toUpperCase();
        System.out.println("DeWorker01的action方法执行结束");
        return upperCase;
    }

    @Override
    public void result(boolean success, String param, WorkResult<String> workResult) {
        System.out.println("result - DeWorker01执行结果: " + workResult.getResult());
    }
}
